﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Htss.Platform.Data;

namespace DreamBox.DAL.Admin
{
    public class Competence
    {
        /// <summary>
        /// 删除权限
        /// </summary>
        /// <param name="ComID"></param>
        /// <returns></returns>
        public bool Delete(int ComID)
        {
            DbAction action = new DbAction("dbox_UserCompetence");
            action.SetFields("ComID", ComID, DbFieldType.Condition);
            return action.Delete();
        }
        /// <summary>
        /// 更新权限信息
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool Update(DreamBox.Model.Admin.Competence m)
        {
            DbAction action = new DbAction("dbox_UserCompetence");
            action.SetFields("ComID", m.ComID, DbFieldType.Condition);
            action.SetFields("CompetenceName", m.CompetenceName);
            action.SetFields("Url", m.Url);
            action.SetFields("IsType", m.IsType);
            action.SetFields("ParentID", m.ParentID);
            action.SetFields("NodeCount", m.NodeCount);
            return action.Update();
        }
        /// <summary>
        /// 新增权限
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool Add(DreamBox.Model.Admin.Competence m)
        {
            DbAction action = new DbAction("dbox_UserCompetence");
            action.SetFields("CompetenceName",m.CompetenceName);
            action.SetFields("Url", m.Url);
            action.SetFields("IsType",m.IsType);
            action.SetFields("ParentID", m.ParentID);
            action.SetFields("NodeCount",m.NodeCount);
            return action.Insert();
        }
    }
}
